import { baseRequest } from '@/utils/request'

const request = (url, ...arg) => {
  return baseRequest(`/ai/db${url}`, ...arg)
}

/**
 * 获取向量库中的数据
 * @returns {Promise<Object>} 返回向量库数据列表
 */
export function listDatabaseSchema(data) {
  return request('/schema/list', data, 'get')
}

/**
 * 批量删除向量数据
 */
export function deleteVectors(data) {
  return request('/schema/delete', data, 'post')
}

/**
 * 添加训练数据
 * @param {Object} data 包含datasourceId和trainType
 * @returns {Promise<Object>} 返回训练结果
 */
export function embedDatabaseSchema(data) {
  return request('/schema/embed', data, 'get')
}